#include <algorithm>
#include <algorithm>  // STL 通用算法
#include <array>      // C++11 新增
#include <cstdint>
#include <deque>
#include <forward_list>  // C++11 新增
#include <functional>    // 函数对象和 Lambda 表达式
#include <future>
#include <gtest/gtest.h>
#include <iostream>
#include <iterator>  // 迭代器支持
#include <list>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <string.h>
#include <unordered_map>  // C++11 新增
#include <unordered_set>  // C++11 新增
#include <utility>        // 包含 pair 模板类
#include <vector>

#include "log/logger.h"
#include "memery/os_memery.h"
#include "thread/os_thread.h"
TEST(os_memery_test, test_basic_int8_t)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();          // 总内存池大小
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();        // 已分配内存大小
    size_t init_peak_alloc = get_memery_manager()->get_peak_allocated();          // 分配内存大小峰值
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();        // 总分配次数
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();    // 总释放次数
    size_t init_remaining_memory = get_memery_manager()->get_remaining_memory();  // 内存池剩余大小

    int8_t* tmp1 = os_new int8_t(5);
    EXPECT_EQ(*tmp1, 5);
    size_t maxnum = std::max(init_peak_alloc, init_cur_alloc + sizeof(int8_t));
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc + sizeof(int8_t));
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory - sizeof(int8_t));
    os_delete tmp1;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory);
}

TEST(os_memery_test, test_basic_int16_t)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_peak_alloc = get_memery_manager()->get_peak_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();
    size_t init_remaining_memory = get_memery_manager()->get_remaining_memory();

    int16_t* tmp1 = os_new int16_t(100);
    EXPECT_EQ(*tmp1, 100);
    size_t maxnum = std::max(init_peak_alloc, init_cur_alloc + sizeof(int16_t));
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc + sizeof(int16_t));
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory - sizeof(int16_t));
    os_delete tmp1;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory);
}

TEST(os_memery_test, test_basic_int32_t)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_peak_alloc = get_memery_manager()->get_peak_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();
    size_t init_remaining_memory = get_memery_manager()->get_remaining_memory();

    int32_t* tmp1 = os_new int32_t(100000);
    EXPECT_EQ(*tmp1, 100000);
    size_t maxnum = std::max(init_peak_alloc, init_cur_alloc + sizeof(int32_t));
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc + sizeof(int32_t));
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory - sizeof(int32_t));
    os_delete tmp1;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory);
}

TEST(os_memery_test, test_basic_int64_t)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_peak_alloc = get_memery_manager()->get_peak_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();
    size_t init_remaining_memory = get_memery_manager()->get_remaining_memory();

    int64_t* tmp1 = os_new int64_t(10000000000LL);
    EXPECT_EQ(*tmp1, 10000000000LL);
    size_t maxnum = std::max(init_peak_alloc, init_cur_alloc + sizeof(int64_t));
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc + sizeof(int64_t));
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory - sizeof(int64_t));
    os_delete tmp1;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory);
}

TEST(os_memery_test, test_basic_uint8_t)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_peak_alloc = get_memery_manager()->get_peak_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();
    size_t init_remaining_memory = get_memery_manager()->get_remaining_memory();

    uint8_t* tmp1 = os_new uint8_t(200);
    EXPECT_EQ(*tmp1, 200);
    size_t maxnum = std::max(init_peak_alloc, init_cur_alloc + sizeof(uint8_t));
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc + sizeof(uint8_t));
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory - sizeof(uint8_t));
    os_delete tmp1;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory);
}

TEST(os_memery_test, test_basic_uint16_t)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_peak_alloc = get_memery_manager()->get_peak_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();
    size_t init_remaining_memory = get_memery_manager()->get_remaining_memory();

    uint16_t* tmp1 = os_new uint16_t(50000);
    EXPECT_EQ(*tmp1, 50000);
    size_t maxnum = std::max(init_peak_alloc, init_cur_alloc + sizeof(uint16_t));
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc + sizeof(uint16_t));
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory - sizeof(uint16_t));
    os_delete tmp1;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory);
}

TEST(os_memery_test, test_basic_uint32_t)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_peak_alloc = get_memery_manager()->get_peak_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();
    size_t init_remaining_memory = get_memery_manager()->get_remaining_memory();

    uint32_t* tmp1 = os_new uint32_t(3000000000UL);
    EXPECT_EQ(*tmp1, 3000000000UL);
    size_t maxnum = std::max(init_peak_alloc, init_cur_alloc + sizeof(uint32_t));
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc + sizeof(uint32_t));
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory - sizeof(uint32_t));
    os_delete tmp1;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory);
}

TEST(os_memery_test, test_basic_uint64_t)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_peak_alloc = get_memery_manager()->get_peak_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();
    size_t init_remaining_memory = get_memery_manager()->get_remaining_memory();

    uint64_t* tmp1 = os_new uint64_t(1000000000000ULL);
    EXPECT_EQ(*tmp1, 1000000000000ULL);
    size_t maxnum = std::max(init_peak_alloc, init_cur_alloc + sizeof(uint64_t));
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc + sizeof(uint64_t));
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory - sizeof(uint64_t));
    os_delete tmp1;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory);
}

TEST(os_memery_test, test_basic_char)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_peak_alloc = get_memery_manager()->get_peak_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();
    size_t init_remaining_memory = get_memery_manager()->get_remaining_memory();

    char* tmp1 = os_new char('A');
    EXPECT_EQ(*tmp1, 'A');
    size_t maxnum = std::max(init_peak_alloc, init_cur_alloc + sizeof(char));
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc + sizeof(char));
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory - sizeof(char));
    os_delete tmp1;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory);
}

TEST(os_memery_test, test_basic_bool)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_peak_alloc = get_memery_manager()->get_peak_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();
    size_t init_remaining_memory = get_memery_manager()->get_remaining_memory();

    bool* tmp1 = os_new bool(true);
    EXPECT_EQ(*tmp1, true);
    size_t maxnum = std::max(init_peak_alloc, init_cur_alloc + sizeof(bool));
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc + sizeof(bool));
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory - sizeof(bool));
    os_delete tmp1;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory);
}

TEST(os_memery_test, test_basic_float)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_peak_alloc = get_memery_manager()->get_peak_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();
    size_t init_remaining_memory = get_memery_manager()->get_remaining_memory();

    float* tmp1 = os_new float(3.14f);
    EXPECT_FLOAT_EQ(*tmp1, 3.14f);
    size_t maxnum = std::max(init_peak_alloc, init_cur_alloc + sizeof(float));
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc + sizeof(float));
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory - sizeof(float));
    os_delete tmp1;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory);
}

TEST(os_memery_test, test_basic_double)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_peak_alloc = get_memery_manager()->get_peak_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();
    size_t init_remaining_memory = get_memery_manager()->get_remaining_memory();

    double* tmp1 = os_new double(2.718281828);
    EXPECT_DOUBLE_EQ(*tmp1, 2.718281828);
    size_t maxnum = std::max(init_peak_alloc, init_cur_alloc + sizeof(double));
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc + sizeof(double));
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory - sizeof(double));
    os_delete tmp1;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory);
}

TEST(os_memery_test, test_basic_long_double)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_peak_alloc = get_memery_manager()->get_peak_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();
    size_t init_remaining_memory = get_memery_manager()->get_remaining_memory();

    long double* tmp1 = os_new long double(1.4142135623730950488L);
    EXPECT_DOUBLE_EQ((double)*tmp1, 1.4142135623730950488);
    size_t maxnum = std::max(init_peak_alloc, init_cur_alloc + sizeof(long double));
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc + sizeof(long double));
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory - sizeof(long double));
    os_delete tmp1;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory);
}

TEST(os_memery_test, test_basic_wchar_t)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_peak_alloc = get_memery_manager()->get_peak_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();
    size_t init_remaining_memory = get_memery_manager()->get_remaining_memory();

    wchar_t* tmp1 = os_new wchar_t(L'中');
    EXPECT_EQ(*tmp1, L'中');
    size_t maxnum = std::max(init_peak_alloc, init_cur_alloc + sizeof(wchar_t));
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc + sizeof(wchar_t));
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory - sizeof(wchar_t));
    os_delete tmp1;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory);
}

// 接下来编写复杂类型的内存分配测试

// 定义测试用的结构体
struct TestStruct {
    int a;
    float b;
    bool c;

    TestStruct() :
        a(0),
        b(0.0f),
        c(false)
    {
    }
    TestStruct(int a_, float b_, bool c_) :
        a(a_),
        b(b_),
        c(c_)
    {
    }
    bool operator<(const TestStruct& other) const
    {
        return a < other.a;
    }
};

// 定义测试用的枚举
enum class TestEnum {
    VALUE1,
    VALUE2,
    VALUE3
};

// 定义测试用的类
class TestClass
{
public:
    int value;
    std::string name;
    int* ptr;

    TestClass() :
        value(0),
        name("default"),
        ptr(nullptr)
    {
    }

    TestClass(int v) :
        value(v),
        name("non-default"),
        ptr(nullptr)
    {
    }
    TestClass(int* v)
    {
        ptr = v;
    }
    TestClass(int v, const std::string& n) :
        value(v),
        name(n),
        ptr(nullptr)
    {
    }
    // 必须定义相等运算符
    bool operator==(const TestClass& other) const
    {
        return value == other.value && name == other.name;
    }
    bool operator<(const TestClass& other) const
    {
        return value < other.value;
    }
    ~TestClass()
    {
        value = -1;  // 析构标记
        name = "";
        if (ptr) {
            *ptr = -1;
        }
    }
};

// 测试复杂自定义类型的内存分配
TEST(os_memery_test, test_struct_default_constructor)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_peak_alloc = get_memery_manager()->get_peak_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();
    size_t init_remaining_memory = get_memery_manager()->get_remaining_memory();

    TestStruct* tmp = os_new TestStruct();
    EXPECT_EQ(tmp->a, 0);
    EXPECT_FLOAT_EQ(tmp->b, 0.0f);
    EXPECT_FALSE(tmp->c);

    size_t maxnum = std::max(init_peak_alloc, init_cur_alloc + sizeof(TestStruct));
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc + sizeof(TestStruct));
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory - sizeof(TestStruct));

    os_delete tmp;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory);
}

TEST(os_memery_test, test_struct_parameterized_constructor)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_peak_alloc = get_memery_manager()->get_peak_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();
    size_t init_remaining_memory = get_memery_manager()->get_remaining_memory();

    TestStruct* tmp = os_new TestStruct(42, 3.14f, true);
    EXPECT_EQ(tmp->a, 42);
    EXPECT_FLOAT_EQ(tmp->b, 3.14f);
    EXPECT_TRUE(tmp->c);

    size_t maxnum = std::max(init_peak_alloc, init_cur_alloc + sizeof(TestStruct));
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc + sizeof(TestStruct));
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory - sizeof(TestStruct));

    os_delete tmp;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory);
}

TEST(os_memery_test, test_enum_allocation)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_peak_alloc = get_memery_manager()->get_peak_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();
    size_t init_remaining_memory = get_memery_manager()->get_remaining_memory();

    TestEnum* tmp = os_new TestEnum(TestEnum::VALUE2);
    EXPECT_EQ(*tmp, TestEnum::VALUE2);

    size_t maxnum = std::max(init_peak_alloc, init_cur_alloc + sizeof(TestEnum));
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc + sizeof(TestEnum));
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory - sizeof(TestEnum));

    os_delete tmp;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory);
}

TEST(os_memery_test, test_class_default_constructor)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_peak_alloc = get_memery_manager()->get_peak_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();
    size_t init_remaining_memory = get_memery_manager()->get_remaining_memory();

    TestClass* tmp = os_new TestClass();
    EXPECT_EQ(tmp->value, 0);
    EXPECT_EQ(tmp->name, "default");

    size_t maxnum = std::max(init_peak_alloc, init_cur_alloc + sizeof(TestClass));
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc + sizeof(TestClass));
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory - sizeof(TestClass));

    os_delete tmp;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory);
}

TEST(os_memery_test, test_class_parameterized_constructor)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_peak_alloc = get_memery_manager()->get_peak_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();
    size_t init_remaining_memory = get_memery_manager()->get_remaining_memory();

    TestClass* tmp = os_new TestClass(100, "test_name");
    EXPECT_EQ(tmp->value, 100);
    EXPECT_EQ(tmp->name, "test_name");

    size_t maxnum = std::max(init_peak_alloc, init_cur_alloc + sizeof(TestClass));
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc + sizeof(TestClass));
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory - sizeof(TestClass));

    os_delete tmp;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory);
}

TEST(os_memery_test, test_class_single_parameter_constructor)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_peak_alloc = get_memery_manager()->get_peak_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();
    size_t init_remaining_memory = get_memery_manager()->get_remaining_memory();

    TestClass* tmp = os_new TestClass(42);
    EXPECT_EQ(tmp->value, 42);
    EXPECT_EQ(tmp->name, "non-default");

    size_t maxnum = std::max(init_peak_alloc, init_cur_alloc + sizeof(TestClass));
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc + sizeof(TestClass));
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory - sizeof(TestClass));

    // 验证析构函数被调用
    int old_value = tmp->value;
    os_delete tmp;
    // 注意：由于tmp已被释放，我们只能通过内存管理器的状态来验证行为
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);
    EXPECT_EQ(get_memery_manager()->get_total_memory(), init_total_memory);
    EXPECT_EQ(get_memery_manager()->get_peak_allocated(), maxnum);
    EXPECT_EQ(get_memery_manager()->get_remaining_memory(), init_remaining_memory);
}
// 测试析构函数
TEST(os_memery_test, test_class_call_destroy)
{
    int tmp_val = 1;
    TestClass* tmp = os_new TestClass(&tmp_val);
    os_delete tmp;
    EXPECT_EQ(tmp_val, -1);
}

// 测试C++11 所有容器的内存申请与释放
TEST(os_memery_test, test_vector_int)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::vector<int>* vec = os_new std::vector<int>();
    size_t init_cur_alloc_be = get_memery_manager()->get_current_allocated();
    vec->push_back(1);
    vec->push_back(2);
    vec->push_back(3);
    size_t alloc_after_create = get_memery_manager()->get_current_allocated();

    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete vec;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}

TEST(os_memery_test, test_vector_custom_class)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::vector<TestClass>* vec = os_new std::vector<TestClass>();
    vec->push_back(TestClass(1, "first"));
    vec->push_back(TestClass(2, "second"));

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete vec;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}

TEST(os_memery_test, test_array_int)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::array<int, 5>* arr = os_new std::array<int, 5>();
    (*arr)[0] = 10;
    (*arr)[1] = 20;

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete arr;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}

TEST(os_memery_test, test_array_custom_struct)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::array<TestStruct, 3>* arr = os_new std::array<TestStruct, 3>();
    (*arr)[0] = TestStruct(1, 1.5f, true);
    (*arr)[1] = TestStruct(2, 2.5f, false);

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete arr;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}

TEST(os_memery_test, test_deque_int)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::deque<int>* deq = os_new std::deque<int>();
    deq->push_back(1);
    deq->push_front(2);

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete deq;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}

TEST(os_memery_test, test_deque_custom_class)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::deque<TestClass>* deq = os_new std::deque<TestClass>();
    deq->push_back(TestClass(1, "back"));
    deq->push_front(TestClass(2, "front"));

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete deq;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}

TEST(os_memery_test, test_forward_list_int)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::forward_list<int>* flist = os_new std::forward_list<int>();
    flist->push_front(1);
    flist->push_front(2);

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete flist;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}

TEST(os_memery_test, test_forward_list_custom_class)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::forward_list<TestClass>* flist = os_new std::forward_list<TestClass>();
    flist->push_front(TestClass(1, "first"));
    flist->push_front(TestClass(2, "second"));

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete flist;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}

TEST(os_memery_test, test_list_int)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::list<int>* list = os_new std::list<int>();
    list->push_back(1);
    list->push_back(2);

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete list;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}

TEST(os_memery_test, test_list_custom_struct)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::list<TestStruct>* list = os_new std::list<TestStruct>();
    list->push_back(TestStruct(1, 1.0f, true));
    list->push_back(TestStruct(2, 2.0f, false));

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete list;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}

TEST(os_memery_test, test_set_int)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::set<int>* set = os_new std::set<int>();
    set->insert(1);
    set->insert(2);
    set->insert(3);

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete set;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}

TEST(os_memery_test, test_set_custom_class)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::set<TestClass>* set = os_new std::set<TestClass>({ TestClass(1, "first"), TestClass(2, "second") });

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete set;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}

TEST(os_memery_test, test_multiset_int)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::multiset<int>* mset = os_new std::multiset<int>();
    mset->insert(1);
    mset->insert(1);  // 允许重复
    mset->insert(2);

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete mset;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}

TEST(os_memery_test, test_multiset_custom_struct)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::multiset<TestStruct>* mset = os_new std::multiset<TestStruct>();
    mset->insert(TestStruct(1, 1.0f, true));
    mset->insert(TestStruct(1, 1.0f, true));  // 允许重复
    mset->insert(TestStruct(2, 2.0f, false));

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete mset;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}

TEST(os_memery_test, test_map_int)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::map<int, int>* map = os_new std::map<int, int>();
    (*map)[1] = 10;
    (*map)[2] = 20;

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete map;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}

TEST(os_memery_test, test_map_custom_types)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::map<std::string, TestClass>* map = os_new std::map<std::string, TestClass>();
    (*map)["first"] = TestClass(1, "first");
    (*map)["second"] = TestClass(2, "second");

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete map;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}

TEST(os_memery_test, test_multimap_int)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::multimap<int, int>* mmap = os_new std::multimap<int, int>();
    mmap->insert(std::make_pair(1, 10));
    mmap->insert(std::make_pair(1, 15));  // 允许重复key
    mmap->insert(std::make_pair(2, 20));

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete mmap;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}

TEST(os_memery_test, test_multimap_custom_types)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::multimap<std::string, TestClass>* mmap = os_new std::multimap<std::string, TestClass>();
    mmap->insert(std::make_pair("group1", TestClass(1, "first")));
    mmap->insert(std::make_pair("group1", TestClass(2, "second")));
    mmap->insert(std::make_pair("group2", TestClass(3, "third")));

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete mmap;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}

TEST(os_memery_test, test_unordered_set_int)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::unordered_set<int>* uset = os_new std::unordered_set<int>();
    uset->insert(1);
    uset->insert(2);
    uset->insert(3);

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete uset;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}
#if 0
TEST(os_memery_test, test_unordered_set_custom_class)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::unordered_set<TestClass>* uset = os_new std::unordered_set<TestClass>();
    uset->insert(TestClass(1, "first"));
    uset->insert(TestClass(2, "second"));

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete uset;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}
#endif
TEST(os_memery_test, test_unordered_multiset_int)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::unordered_multiset<int>* umset = os_new std::unordered_multiset<int>();
    umset->insert(1);
    umset->insert(1);  // 允许重复
    umset->insert(2);

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete umset;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}

// TEST(os_memery_test, test_unordered_multiset_custom_struct)
// {
//     size_t init_total_memory = get_memery_manager()->get_total_memory();
//     size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
//     size_t init_total_alloc = get_memery_manager()->get_total_allocated();
//     size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

//     std::unordered_multiset<TestStruct>* umset = os_new std::unordered_multiset<TestStruct>();
//     umset->insert(TestStruct(1, 1.0f, true));
//     umset->insert(TestStruct(1, 1.0f, true));  // 允许重复
//     umset->insert(TestStruct(2, 2.0f, false));

//     size_t alloc_after_create = get_memery_manager()->get_current_allocated();
//     EXPECT_GT(alloc_after_create, init_cur_alloc);
//     EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

//     os_delete umset;
//     EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
//     EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
// }

TEST(os_memery_test, test_unordered_map_int)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::unordered_map<int, int>* umap = os_new std::unordered_map<int, int>();
    (*umap)[1] = 10;
    (*umap)[2] = 20;

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete umap;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}

TEST(os_memery_test, test_unordered_map_custom_types)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::unordered_map<std::string, TestClass>* umap = os_new std::unordered_map<std::string, TestClass>();
    (*umap)["first"] = TestClass(1, "first");
    (*umap)["second"] = TestClass(2, "second");

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete umap;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}

TEST(os_memery_test, test_unordered_multimap_int)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::unordered_multimap<int, int>* ummap = os_new std::unordered_multimap<int, int>();
    ummap->insert(std::make_pair(1, 10));
    ummap->insert(std::make_pair(1, 15));  // 允许重复key
    ummap->insert(std::make_pair(2, 20));

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete ummap;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}

TEST(os_memery_test, test_unordered_multimap_custom_types)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::unordered_multimap<std::string, TestClass>* ummap = os_new std::unordered_multimap<std::string, TestClass>();
    ummap->insert(std::make_pair("group1", TestClass(1, "first")));
    ummap->insert(std::make_pair("group1", TestClass(2, "second")));
    ummap->insert(std::make_pair("group2", TestClass(3, "third")));

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete ummap;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}

TEST(os_memery_test, test_stack_int)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::stack<int>* stack = os_new std::stack<int>();
    stack->push(1);
    stack->push(2);
    stack->push(3);

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete stack;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}

TEST(os_memery_test, test_stack_custom_class)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::stack<TestClass>* stack = os_new std::stack<TestClass>();
    stack->push(TestClass(1, "first"));
    stack->push(TestClass(2, "second"));

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete stack;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}

TEST(os_memery_test, test_queue_int)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::queue<int>* queue = os_new std::queue<int>();
    queue->push(1);
    queue->push(2);
    queue->push(3);

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete queue;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}

TEST(os_memery_test, test_queue_custom_struct)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::queue<TestStruct>* queue = os_new std::queue<TestStruct>();
    queue->push(TestStruct(1, 1.0f, true));
    queue->push(TestStruct(2, 2.0f, false));

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete queue;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}

TEST(os_memery_test, test_priority_queue_int)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    std::priority_queue<int>* pqueue = os_new std::priority_queue<int>();
    pqueue->push(1);
    pqueue->push(3);
    pqueue->push(2);

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete pqueue;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}

TEST(os_memery_test, test_priority_queue_custom_class)
{
    size_t init_total_memory = get_memery_manager()->get_total_memory();
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();

    auto cmp = [](const TestClass& a, const TestClass& b) {
        return a.value < b.value;
    };
    std::priority_queue<TestClass, std::vector<TestClass>, decltype(cmp)>* pqueue =
        os_new std::priority_queue<TestClass, std::vector<TestClass>, decltype(cmp)>(cmp);

    pqueue->push(TestClass(1, "lowest"));
    pqueue->push(TestClass(3, "highest"));
    pqueue->push(TestClass(2, "middle"));

    size_t alloc_after_create = get_memery_manager()->get_current_allocated();
    EXPECT_GT(alloc_after_create, init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_allocated(), init_total_alloc + 1);

    os_delete pqueue;
    EXPECT_EQ(get_memery_manager()->get_current_allocated(), init_cur_alloc);
    EXPECT_EQ(get_memery_manager()->get_total_deallocated(), init_total_dealloc + 1);
}
class MyClass
{
public:
    MyClass(int value) :
        data(value)
    {
        std::cout << "构造 MyClass: " << data << std::endl;
    }

    ~MyClass()
    {
        std::cout << "析构 MyClass: " << data << std::endl;
    }

    void print() const
    {
        std::cout << "MyClass data: " << data << std::endl;
    }

    int data;
};
TEST(os_memery_test, test_unique_ptr)
{
    std::cout << "test_unique_ptr" << std::endl;
    int* tmp = os_new int(0);
    {
        os_shared_ptr<MyClass> ptr0;
        {
            os_shared_ptr<MyClass> ptr1 = os_make_shared(MyClass, 1);
            ptr0 = ptr1;
            std::cout << "exit ptr" << std::endl;
        }
        std::cout << "exit ptr 2" << std::endl;
    }
    std::cout << "exit ptr 3" << std::endl;
    os_delete tmp;
    {
        os_unique_ptr<MyClass> unique_ptr0 = os_make_unique(MyClass, 2);
        {
            os_unique_ptr<MyClass> unique_ptr1 = os_make_unique(MyClass, 3);
            std::cout << "exit ptr 4" << std::endl;
            unique_ptr0 = std::move(unique_ptr1);
        }
        std::cout << "exit ptr 5" << std::endl;
    }
    int a = 5;
    std::cout << "exit ptr 6" << std::endl;
}

TEST(os_memery_test, test_vector)
{
    size_t init_cur_alloc = get_memery_manager()->get_current_allocated();// 当前已分配内存
    size_t init_total_alloc = get_memery_manager()->get_total_allocated();// 当前分配次数
    size_t init_total_dealloc = get_memery_manager()->get_total_deallocated();//当前是否次数
    std::cout<<"init_cur_alloc:"<<init_cur_alloc<<std::endl;
    std::cout<<"init_total_alloc:"<<init_total_alloc<<std::endl;
    std::cout<<"init_total_dealloc:"<<init_total_dealloc<<std::endl;

    os_vector<int> *vec = os_new_vector(int);
}
